package com.csust.homework.exer02;

import java.lang.reflect.Constructor;

public class Homework02 {
    public static void main(String[] args) throws Exception {
        Class<?> clazz = Class.forName("java.io.File");
        Constructor<?>[] declaredConstructors = clazz.getDeclaredConstructors();
        for (Constructor<?> constructor : declaredConstructors) {
            System.out.println(constructor);
        }
//        clazz.newInstance()
        Constructor<?> constructor = clazz.getDeclaredConstructor(String.class);
        Object o = constructor.newInstance("D:\\login.js");
        clazz.getDeclaredMethod("createNewFile").invoke(o);
        System.out.println(o.getClass());
        System.out.println("文件创建成功");

    }
}
